<template>
  <div class="order-container" ref="orderContainer" v-html="iframeHtml"></div>
</template>
  <script>
import { getToken } from "@/utils/auth";
export default {
  data() {
    return {
      iframeHtml: `<iframe src="${process.env.VUE_APP_CASHIER_WEB_ORIGIN}/#/mall/order?useIframe=1" width="100%" height="100%" frameborder="0"></iframe>`,
    };
  },
  mounted() {
    const iframe = this.$refs.orderContainer.querySelector("iframe");
    iframe.onload = function () {
      iframe.contentWindow.postMessage(
        {
          token: getToken(),
        },
        process.env.VUE_APP_CASHIER_WEB_ORIGIN
      );
    };
  },
};
</script>
  <style lang="scss" scoped>
.order-container {
  height: 100%;
  flex-grow: 1;
}
</style>